home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 16
/
Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso
/
Aminet
/
util
/
wb
/
mrjQuote.lha
/
mrjQuote2.30
/
ARexx
/
IndentAddSig.bed
next >
Wrap
Text File
|
1996-09-28
|
5KB
|
116 lines
/* BED / mrjQuote email/news indenter and signature appender
©1996 Mark Rigby-Jones for mrjsw
mark.rigby-jones@keble.oxford.ac.uk <*> http://users.ox.ac.uk/~kebl0206/
$VER: IndentAddSig.bed 1.1 (27.09.96)
This script is intende for use when editing emails/news articles with
Blacks Editor. It can add an indent ("> " by default) to every non-empty
line from the cursor position downward. It can also use mrjQuote to
generate a random signature and append this to the buffer, together with
the required dashes "-- " and a little extra space.
Configuration:
Set QuotePort to the name of mrjQuote's ARexx port, and FileName and
SigName to the correct paths. Change DoSig from "load" to "yes" if you do
not want mrjQuote to be loaded if it isn't already (a new signature will
not be created in this case)
Usage:
Put this script in BED:ARexx/ and then call it as required:
"BED:Rexx/IndentAddSig" - indent text and add signature
"BED:Rexx/IndentAddSig NOINDENT" - add signature only
"BED:Rexx/IndentAddSig NOSIG" - indent text only */
QuotePort = "QUOTE" /* Change this if neccessary */
FileName = "mrjsw:Quote" /* Full path to mrjQuote */
SigName = "Home:.signature" /* Full path to signature */
Indent = "> " /* What to use as an indent */
DoSig = "load" /* Default signature mode */
Arg Opt . /* Parse any argument */
If Opt = "NOINDENT" Then /* Indenting disabled */
Indent=""
If Opt = "NOSIG" Then /* Signature disabled */
DoSig="no"
Options Results /* Enable return codes */
If (Left(Address(),4) ~= "BED_") Then Do
Address "BED" /* If not called from doc */
GetLastDoc /* get last doc edited */
Address Value Result
End
BEDPort = Address() /* Get BED's port name */
SetInputLock ON /* Lock GUI, gain access */
SetDisplayLock ON
Options FailAt 6 /* Ignore warnings */
Signal On Syntax /* Ensure clean exit */
SetStatusBar "Indenting text..."
GetFileInfo
Lines = Word(RESULT,1) /* Get number of lines */
GetCursorPos
Line = Word(RESULT,1) /* Get current line */
MoveSOL
Do i = Line To Lines /* For each remaining line */
GetChar /* get info about line */
If RC = 0 Then Do /* if line is non-blank */
Text '"'Indent'"' /* add Indent to start */
MoveSOL
If i = Lines Then Do
MoveEOL /* if it's the last line */
InsertLine /* insert an extra line */
End
End
MoveDown /* move to next line */
End
InsertLine /* Add an extra blank line */
If DoSig = "no" Then Do /* If not to do signature */
SetDisplayLock OFF /* unlock BED */
SetInputLock OFF
Exit /* and exit the script */
End
SetStatusBar "Generating Signature..."
If (~Show(P,QuotePort) & DoSig="load") Then Do /* If mrjQuote isn't loaded */
Address "COMMAND"
'Run >NIL: "'FileName'" CDITY AREXX QUIET' /* then run it */
WaitForPort QuotePort /* and wait for it to load */
End
If Show(P,QuotePort) Then Do /* If mrjQuote is running */
Address Value QuotePort
Sig /* create a random sig */
End
Address Value BEDPort
SetBookMark 0
InsertFile '"'SigName'"' /* Append signature file */
MoveBookMark 0
ClearBookMark 0
InsertLine /* Insert blank line */
If Lines > 1 Then /* " if file non-empty */
InsertLine
Text "-- " /* Insert signature dashes */
InsertLine
MoveUp 3 /* Move cursor back up */
SetDisplayLock OFF /* Unlock BED */
SetInputLock OFF
Exit
Syntax: /* If there's an error */
SetStatusBar '"Error, line 'SIGL' : 'ErrorText(RC)'"'
Address Value BEDPort /* ^display details */
SetDisplayLock OFF /* and unlock GoldEd */
SetInputLock OFF
Exit